package com.pony.controller;

import com.pony.entity.Hy;
import com.pony.service.HyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@RequestMapping("/hy")
@Controller
public class HyController {

    @Autowired
    private HyService hyService;


    @RequestMapping("/getAllHy")
    public String getAllHy(Model model) {
        List<Hy> list = hyService.getAll();
        model.addAttribute("list", list);
        return "hy";
    }

    @RequestMapping("/delHy")
    public String delHy(int id){
        hyService.delHy(id);
        return "redirect:/hy/getAllHy.do";
    }
}
